let mywm=new WeakMap();

class Fish{
    constructor(name){
        mywm.set(this,{
            _fishbone:['章鱼','鲤鱼','鲸鱼']
        })
        this.name=name;
    }
    isBone(){
        return mywm.get(this)._fishbone.includes(this.name);
    }

}




let fish1=new Fish('章鱼');
let fish2=new Fish('鲫鱼');
console.log(fish1.isBone())
console.log(fish2.isBone())
const privateData = new WeakMap();


// 用weakmap做私有属性
class Person {
    constructor(name, age) {
        privateData.set(this, { name: name, age: age });
    }

    getName() {
        return privateData.get(this).name;
    }

    getAge() {
        return privateData.get(this).age;
    }
}

let person1=new Person('nisha',45);


export default Person;